<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
    <head>
        <title></title>
        <meta charset="utf-8">
        <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
        <link rel="stylesheet" href="css/fonts/font-awesome.min.css">
        <link rel="stylesheet" href="css/ui-box.css">
        <link rel="stylesheet" href="css/ui-base.css">
        <link rel="stylesheet" href="css/ui-color.css">
        <link rel="stylesheet" href="css/appcan.icon.css">
        <link rel="stylesheet" href="css/appcan.control.css">
        <link rel="stylesheet" href="css/base.css">
        <link rel="stylesheet" href="css/media.css?v=1123">
        <link rel="stylesheet" href="css/lczjstyle.css?v=1238">
        <style type="text/css">
        #search{
            display: none;
        }
        .btn-img{
          background-image:url('images/zy_jk.png');
          background-position: center;
          background-repeat: no-repeat;
          background-size: 70%;
            
        }
         .c8EC2DA{
            background: #8EC2DA;
        }
        .bdr{
            border: 1px solid red;
        }
        .hide{
            overflow: hidden; /*自动隐藏文字*/
            text-overflow: ellipsis;/*文字隐藏后添加省略号*/
            white-space: nowrap;/*强制不换行*/
        } 
        
         </style>
    </head>
    <body class="bcwhite">
    <div class="up ub ub-ver " tabindex="0" data-control="PAGE" id="Page">
        <!-- 搜索框开始 -->
        <div class=" wtp100 h_100" id="search" style="background-color: rgba(230,230,230,.8);position: fixed; z-index: 9999;">
            <div class="bdr-t"></div>
            <div id="wrap" class="ub-ver ub-ac bcwhite wtp95 uc-a3 marat0">
                <div class="pt10 wgt">
                    <div class="ub ub-pc fs9">
                        <div class="pr12 lh20 ">机场三字码</div>
                        <h6 class="bl bdr-black bora03 fs9 bl lh20 tx-c wtp40" id="SanZiMa" onclick="setSanZiMa()"></h6>
                    </div>
                </div>
                <div class="pt10 wtp80 marat0">
                    <div class="ub ub-pc fs9">
                        <div class="wtp45 bdr-black bora03 bc-img-r h20 lh20 tx-c pr10" id="startDate">请选择日期</div>
                        <div class="lh20 pl1 pr1">至</div>
                        <div class="wtp45 bdr-black bora03 bc-img-r endD lh20 tx-c pr10" id="endDate">请选择日期</div>
                    </div>
                </div>
                <div class="pt10">
                    <div class="ub ub-pc fs9">
                        <ul class="fs8 marat0 wtp90 tx-c pl5">
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 cityItem" value="9523">安徽</li>
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 cityItem" value="8885">北京</li>
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 cityItem" value="8834">甘肃</li>
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 cityItem" value="7178">江苏</li>
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 cityItem" value="9648">江西</li>
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 cityItem" value="4397">山东</li>
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 cityItem" value="9786">山西</li>
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 cityItem" value="834">上海</li>
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 cityItem" value="8175">四川</li>
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 cityItem" value="8567">武汉</li>
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 cityItem" value="8408">西北</li>
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 cityItem" value="7500">云南</li>
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 cityItem" value="9585">浙江</li>
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 cityItem" value="0">航站管理</li>
                            <li class="wtp28 blin h25 lh25 bcF0F0F0 bora02 mb5 mr5 none" id="cityItemALL">全部</li>
                        </ul>
                    </div>
                </div>
                <div class="pt5 pb5">
                    <div class="ub ub-pc fs9 tx-c cwhite ">
                        <div class="w50 lh25 h25 bc6FCAE9 bora02" id="query">查询</div>
                    </div>
                </div>
            </div>
        </div>
        <!-- 搜索框结束 -->
        <!-- 内容开始 -->
        <div class="content wtp100" data-control="FLEXBOXVER" id="content">
            <div id="" class="ub cwhite">
                <div class="bc8EC2DA w35 h30 lh30 tx-c bdr-bw bs-lf">
                    <div class="fs11">归属地</div>
                </div>
                <div class="w30 h30 lh30 tx-c bcwhite c4892AA bdr-b3EC5F7">
                    <h6 class="fs10">机场</h6>
                </div>
                <div class="ub-f1">
                    <div class="ub-ver ub-pj h30 pt2 c4892AA bcwhite bdr-b3EC5F7">
                        <h6 class="fs9 ub-f1 tx-c" style="width:90%">经<span id="DDSZM">***</span>旅客中转办理统计&nbsp;(D-D)</h6>
                        <div class="ub-f1 pt2 tx-c">
                            <div class="ub">
                                <h6 class="fs9 wtp36">办理总人数</h6>
                                <h6 class="fs9 wtp36">应办总人数</h6>
                                <h6 class="fs9 tx-l wtp28">百分比</h6>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!-- list item-->
            <div class="ub-ver ht100 wtp100">
                <ul id="list_ul">
                   
                </ul>
            </div>
        </div>
    </div>
    
    <script src="js/appcan.js"></script>
    <script src="js/appcan.control.js"></script>
    <script src="js/common.js"></script>
    <script src="js/commo.js"></script>
    <script src="js/selectDate.js?v=123"></script>
    </body>
    <script>
      
      //@LCZJhttp 接口地址  
      var LCZJhttp = h_yddfUrl+"yddfMAS/";
      
      appcan.locStorage.setVal('LCZJhttp',LCZJhttp);
      
      
      appcan.ready(function() {
          
        //接收发布的消息
        uexWindow.subscribeChannelNotification('inland', 'onNotification');
        uexWindow.onNotification = function(cb){
            eval(cb);
       };
       
     });
     
     //判断是否显示搜索框
     var show = true;
     function seacrh(index){
         
      if(index == undefined || index == 0){
      
      if(show){
          
       $('#search').css('display','block');   
       show = false;   
      }else{
        $('#search').css('display','none'); 
        show = true;    
      } 
     
    }
  }
    /*
     * @values  保存城市数组
     * @city    选择的城市
     */
    
    var values = [];
    var city;

    //全选按钮
    appcan.button("#cityItemALL", "btn-act", function() {
           if($(this).hasClass('none')){
           //全选时先清空上次保存的信息
           values = [];
           $('.cityItem').addClass('c8EC2DA'); 
           $('#cityItemALL').css('background','#8EC2DA');
           for(var i = 0; i < $('.cityItem').length; i++ ){
            values.push($('.cityItem')[i].value); 
            city = values.toString().replace(/\[|]/g,'');
            $(this).removeClass('none');
         
            }   
          } else {
           //全不选
           city = '';
           values.length = 0;
           $('.cityItem').removeClass('c8EC2DA'); 
           $('#cityItemALL').css('background','');   
           $(this).addClass('none');  
            
          }  
           
 
              
            
          
  });
    
    //城市按钮   
    appcan.button(".cityItem", "btn-act", function() {
            
            if($(this).hasClass('c8EC2DA')){
             //取消选择
             $(this).removeClass('c8EC2DA'); 
             //然后从数组中删除此条信息 
             values.removeByValue(this.value);   
            
            }else{
             //选择
             city = '';
            $(this).addClass('c8EC2DA');
            //将此条信息加入数组中
            values.push(this.value);
               
            }
            
           city = values.toString().replace(/\[|]/g,'');     
           //console.log(city);
      
  });
  
  
    //查询按钮
    $("#query").click(function(){
     //隐藏搜索框
     $('#search').css('display','none'); 
     show = true;  
     
     uexWindow.toast(1,5,"正在查询...",-1);
      
      var szm = $("#SanZiMa").text();
      $("#DDSZM").text(szm.toLocaleUpperCase());
      //szm.toLocaleUpperCase()
      appcan.locStorage.setVal("SZM","PEK"); 
     // console.log(szm);
      if(!szm){
          uexWindow.closeToast();
       alertts("提示","请输入三字码","确定");
       return;
      }else if(!city){
          uexWindow.closeToast();
       alertts("提示","请选择城市","确定"); 
       return; 
      }else if($(startDate).text() == "请选择日期"){
          uexWindow.closeToast();
       alertts("提示","请选择开始时间","确定"); 
       return;  
      }else if($(endDate).text() == "请选择日期"){
          uexWindow.closeToast();
       alertts("提示","请选择结束时间","确定");  
       return; 
      }else{
          //alert(LCZJhttp+"zyh_queryTransfersD");
          $.ajax({
              url:LCZJhttp+"zyh_queryTransfersD",
              type:"POST",
              dataType:"JSON",
              data:{
                companyCodes:city,
                tciCode:szm.toLocaleUpperCase(),
                startDate:$(startDate).text(),
                endDate:$(endDate).text()
                
              },
              success:function(res){
               // console.log(res);
                res = JSON.parse(res);
                var data = JSON.parse(res.queryTransfersD);
                if(data.data && data.data.length > 0 && data.data != "[]"){
                    console.log(data.data);
                  queryTransfersDCallBack(data.data);  
                }else{
                 uexWindow.toast(1,5,"暂时没有查询到数据...",3000);  
                }
                
                //console.log(JSON.parse(res.queryTransfersD));  
              },
              error:function(){
               uexWindow.toast(1,5,"暂时没有查询到数据...",3000);  
              }
          })
      }
      
  });
  
  function queryTransfersDCallBack(data){
       var tpl = "";
       data.forEach(function(item){
         
         var tplLeft = '<li>'
                     +'<div class="ub cwhite">'
                     +'<div class="bc8EC2DA w35 lh25 tx-c bdr-bw ub ub-ac ub-pc htit bs-lf">'
                     +'<div class="fs9">'+item.companyName+'</div>'
                     +'</div>'
                     +'<div class="ub-f1 c4892AA bcwhite tx-c">'
                     +'<div class="ub-ver">';
         var tplList = "";
         item.checkinList.forEach(function(item){
             //归属地
             
             
            //应办理人员总数
            var ntcDD = item.tcNumDD+item.ntcNumDD;
            
            var bfb = item.tcNumDD/(item.tcNumDD+item.ntcNumDD)*100;
            bfb = bfb+'';
            if(item.tcNumDD == 0 && item.ntcNumDD==0){
                bfb = '0';
            }
            //办理人员百分比
            bfb = bfb.substring(0,5)+'%';
            //归属地下属城市机场信息
           tplList += '<div style="overflow-x: hidden;" class="ub city_line" portName="'+item.portName+'" tcNumDD="'+item.tcNumDD+'" ntcDD="'+ntcDD+'" bfb="'+bfb+'" portCode3="'+item.portCode3+'" tcNumDI="'+item.tcNumDI+'" ntcNumDI="'+item.ntcNumDI+'">'
                   +'<div class="w30 h25 lh25">'
                   +'<div class="fs10 wtp100 bdr-b3EC5F7 hide">'+item.portName+'</div>'
                   +'</div><div class="ub-f1">'
                   +'<div class="ub bdr-b3EC5F7">'
                   +'<div class="pl5 h25 lh25 wtp33 tx-c">'
                   +'<div class="fs11">'+item.tcNumDD+'</div>'
                   +'</div>'
                   +'<div class="pl9 h25 lh25 wtp33 tx-c">'
                   +'<div class="fs11">'+ntcDD+'</div>'
                   +'</div>'
                   +'<div class=" h25 lh25 wtp25 tx-c">'
                   +'<div class="fs11">'+bfb+'</div>'
                   +'</div>'
                   +'<div class="btn-img h25 lh25 tx-c w15"></div>'
                   +'</div>'
                   +'</div>'
                   +'</div>';
           
         });
         
         tpl += tplLeft+tplList+'</div></div></div></li>';  
         //加载列表数据  
         $("#list_ul").html(tpl);
         //关闭提示
         uexWindow.closeToast();
      });
      //点击进去详情页
     $(".city_line").click(function(){
         
       var location = $(this).parent().parent().prev().find('div')[0];
       //保存中转值机信息
       var inand = {};
       //归属地
       inand.location = $(location).text();
       //城市
       inand.portName = $(this).attr('portName');
       //三字码
       inand.portCode3 = $(this).attr('portCode3');
       //国内办理总人数
       inand.tcNumDD = $(this).attr('tcNumDD');
       //国内应办理总人数
       inand.ntcDD = $(this).attr('ntcDD');
       //国内办理百分比
       inand.gnbfb = $(this).attr('bfb');
       //国际办理总人数
       inand.tcNumDI = $(this).attr('tcNumDI');
       //国际应办理总人数
       inand.ntcNumDI = Number($(this).attr('tcNumDI')) + Number($(this).attr('ntcNumDI'));
       //国际办理百分比
       inand.gjbfb = Number($(this).attr('tcNumDI'))/inand.ntcNumDI*100;
       inand.gjbfb = inand.gjbfb+'';
       if($(this).attr('tcNumDI') == '0' && $(this).attr('ntcNumDI')){
       inand.gjbfb = "0";    
       }
       inand.gjbfb = inand.gjbfb.substring(0,5)+"%";
       //国际+国内办理统计总人数
       inand.gngjNumDDDI = Number(inand.tcNumDD) + Number(inand.tcNumDI);
       //国际+国内应办理统计总人数
       inand.ngngjNumDDDI = Number(inand.ntcDD) +　Number(inand.ntcNumDI);
       //国际国内办理统计百分比
       inand.gngjbfb = inand.gngjNumDDDI/inand.ngngjNumDDDI * 100;
       inand.gngjbfb = inand.gngjbfb+'';
       if(inand.gngjNumDDDI == 0 && inand.gngjNumDDDI == 0){
        inand.gngjbfb = '0';   
       }
       inand.gngjbfb = inand.gngjbfb.substring(0,5)+"%";

       console.log(JSON.stringify(inand));  
       //保存国内国际办理中转值机信息汇总。
       appcan.locStorage.setVal('inand',JSON.stringify(inand));
 
        appcan.window.open({
         name: "connectingDetail",
         dataType: 0,
         aniId: 5,
         data: "connectingDetail.html",   
        })
     });
  }
  
  //获取三字码
  function setSanZiMa(){
      var evaluate = {};
      evaluate.windowName = "connectingFlight";
      evaluate.popName = "content";//inland
      evaluate.pageName = "inland";
      evaluate.type = 0;
      appcan.locStorage.setVal("evaluateObj",JSON.stringify(evaluate));
      appcan.window.open('LCairport_select1', 'LCairport_select1.html', '2', '4', 0, 0, 200);
  }
  
  function setAirPort(code){
      //设置三字码
      $("#SanZiMa").text(code);
  }
  
  //提示框
  function alertts(t, c, b) {
             
    appcan.window.alert({
        title : t,
        content : c,
        buttons : b
    });
        }
  
  
  //根据VALUE删除数组中指定的元素
  Array.prototype.removeByValue = function(val) {
      for(var i=0; i<this.length; i++) {
        if(this[i] == val) {
          this.splice(i, 1);
          break;
            }
          }
        }         
   </script>
</html>
